cs = ['小明','小张','小黄','小杨']
yf = ['小黄','小李','小王','小杨','小周']
sc = ['小杨','小张','小吴','小冯','小周']
def sum_people(list1,list2,list3):
    a=len(list1)
    b=len(list2)
    c=len(list3)
    for i in range(0,a):
        for j in range(0,b):
            for k in range(0,c):
                if list1[i] == list2[j]:
                    list2[j]=None
                elif list1[i] == list3[k]:
                    list3[k]=None
                elif list2[j] == list3[k]:
                    list3[k]=None
                else:
                    pass
    list_all = list1+list2+list3
    list_al = []
    for i in range(0,len(list_all)):
        if list_all[i] is not None:
            list_al.append(list_all[i])
    return list_al
def lone_people(list1,list2,list3):
    list4 = list1[:]
    list5 = list2[:]
    list6 = list3[:]
    for i in range(0,len(list4)):
        for j in range(0,len(list5)):
            for k in range(0, len(list6)):
                if list4[i] == list5[j]:
                    list1[i] = None
                    list2[j] = None
                if list4[i] == list6[k]:
                    list1[i] = None
                    list3[k] = None
                if list5[j] == list6[k]:
                    list2[j] = None
                    list3[k] = None
    list_all = list1+list2+list3
    list_al = []
    for i in range(0,len(list_all)):
        if list_all[i] is not None:
            list_al.append(list_all[i])
    return  list_al
def double_people(list1,list2,list3):
    list4 = list1[:]
    list5 = list2[:]
    list6 = list3[:]
    list7 = list1[:]
    list8 = list2[:]
    list9 = list3[:]
    list_all = sum_people(list4,list5,list6)
    list_al = lone_people(list7,list8,list9)
    list_a1 = set(list_al).symmetric_difference(list_all)
    return list_a1

list_a = sum_people(cs[:],yf[:],sc[:])
print(f"部门员工总共有{len(list_a)}人")
print(f"{list_a}")

list_b = lone_people(cs[:],yf[:],sc[:])
print(f"只在一个部门存在的人总共有{len(list_b)}人")
print(f"{list_b}")

list_c = double_people(cs[:],yf[:],sc[:])
print(f"只在两个及以上部门的总共有{len(list_c)}人")
print(list_c)
